/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BD;

import BE.Tipoidentificacion;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author dennis
 */
public class TipoIdentificacionBD {

    private Session session = null;

    public TipoIdentificacionBD() {

         this.session = HibernateUtil.getSessionFactory().getCurrentSession();

    }

    public List<Tipoidentificacion> cargarTipoIdentificacion() {
        List<Tipoidentificacion> lista = null;
        Transaction tx = null;
        try {
            session = HibernateUtil.getSessionFactory().getCurrentSession();
            tx = session.beginTransaction();
            String hql = "from Tipoidentificacion order by srlIdtipoidentificacion";
            Query query = session.createQuery(hql);
            session.flush();
            lista = query.list();
            tx.rollback();

        } catch (Exception e) {
            e.printStackTrace();
            if(tx!=null)
            {
                tx.rollback();
            }
        }
        return lista;
    }



}
